package com.bjx.flow.controller;

import com.bjx.common.core.domain.R;
import com.bjx.flow.domain.vo.FlowDisposeVO;
import com.bjx.flow.service.ITaskDisposeService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @desc: 任务处理控制器
 * @author: liushuai
 * @date: 2023/1/5 13:33
 */
@RequestMapping("/task")
@Tag(name = "任务处理控制器")
@RestController
public class TaskDisposeController {

    @Resource
    private ITaskDisposeService taskDisposeService;

    /**
     * 审批通过
     * @param flowDisposeVO
     * @return: com.bjx.common.core.domain.R<java.lang.String>
     * @Author: liushuai
     * @Date: 2023/1/10 13:22
     */
    @PostMapping("/pass")
    @Operation(summary = "审批通过")
    public R<String> pass(@RequestBody @Validated FlowDisposeVO flowDisposeVO){
        taskDisposeService.pass(flowDisposeVO);
        return R.success();
    }

    /**
     * 审批拒绝
     * @param flowDisposeVO
     * @return: com.bjx.common.core.domain.R<java.lang.String>
     * @Author: liushuai
     * @Date: 2023/1/10 13:22
     */
    @PostMapping("/reject")
    @Operation(summary = "审批拒绝")
    public R<String> reject(@RequestBody @Validated FlowDisposeVO flowDisposeVO){
        taskDisposeService.reject(flowDisposeVO);
        return R.success();
    }
}
